/*
 ============================================================================
 Name		: FETimer.h
 Author	  : shangguan
 Version	 : 1.0
 Copyright   : this calass for file open and save
 Description : CFETimer declaration
 ============================================================================
 */

#ifndef FETIMER_H
#define FETIMER_H

#include <e32base.h>	// For CActive, link against: euser.lib
#include <e32std.h>		// For RTimer, link against: euser.lib

class MFEAutoSave;
class CFETimer : public CActive
{
public:
	// Cancel and destroy
	~CFETimer();

	// Two-phased constructor.
	static CFETimer* NewL(MFEAutoSave &aSave);

	// Two-phased constructor.
	static CFETimer* NewLC(MFEAutoSave &aSave);

public:
	// New functions
	// Function for making the initial request
	void StartL(TTimeIntervalMicroSeconds32 aDelay);
	void Stop();
private:
	// C++ constructor
	CFETimer(MFEAutoSave &aSave);

	// Second-phase constructor
	void ConstructL();

private:
	// From CActive
	// Handle completion
	void RunL();

	// How to cancel me
	void DoCancel();

	// Override to handle leaves from RunL(). Default implementation causes
	// the active scheduler to panic.
	TInt RunError(TInt aError);

private:
	RTimer iTimer; // Provides async timing service
	MFEAutoSave &iAS;

};

#endif // FETIMER_H
